#!/bin/sh
# This regression test is a part of SIPp.
# The variables screen of a scenario with no actions is padded to its
# number of messages plus 6 lines. It used to get half the blank lines
# it meant.
. "`dirname "$0"`/../functions"; init

out=`mktemp`
trap 'rm -f "$out"' EXIT

# Press 4, so that the closing screens start with the variables screen.
timeout -sKILL 20 "`get_sipp`" -nostdin -sf uac.xml -i 127.0.0.1 \
    -p 23180 -cp 23181 127.0.0.1:23182 -m 1 >"$out" 2>&1 &
sipp=$!
sleep 1
perl -e 'use IO::Socket::INET;
    IO::Socket::INET->new(PeerAddr => "127.0.0.1:23181", Proto => "udp")->send("4")'
wait $sipp
status=$?
test $status -eq 0 || fail "exit code $status"

# From its title to the closing line: 20 messages + 6.
lines=`sed -n '/Variables Screen/,/Test Terminated/p' "$out" | sed '$d' | wc -l`
test $lines -eq 26 || fail "a variables screen of $lines lines"
ok
